package org.cloud.im.admin.account.listener;

import com.alibaba.excel.context.AnalysisContext;
import com.alibaba.excel.event.AnalysisEventListener;
import org.cloud.im.admin.account.bo.UserInfoBO;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

/**
 * @Author: w.weidong.lin@abite.com
 * @Description: 用户导入事件监听器
 * @Date: create in 2021/10/26 17:05
 */
public class UserImportEventListener extends AnalysisEventListener<UserInfoBO> {
    public List<UserInfoBO> users = new ArrayList<>();
    public Map<String, UserInfoBO> usersMap = new ConcurrentHashMap<>();

    @Override
    public void invoke(UserInfoBO userInfoBO, AnalysisContext analysisContext) {
        if (userInfoBO != null && userInfoBO.getDeptNo() != null && userInfoBO.getEmpNo() != null) {
            users.add(userInfoBO);
            usersMap.put(userInfoBO.getEmpNo(), userInfoBO);
        }
    }

    @Override
    public void doAfterAllAnalysed(AnalysisContext analysisContext) {

    }
}
